package moduleTest;

import java.io.Serializable;

import javax.persistence.Embeddable;

@Embeddable
public class BookPK implements Serializable {
	private static final long serialVersionUID = 4584527902041605391L;
	
	private String title;
	private String author;
	
	public BookPK() {}


	public BookPK(String title, String author) {
		this.title = title;
		this.author = author;
	}
	
	
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getAuthor() {
		return author;
	}
	public void setAuthor(String author) {
		this.author = author;
	}


	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((author == null) ? 0 : author.hashCode());
		result = prime * result
				+ ((title == null) ? 0 : title.hashCode());
		return result;
	}


	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (!(obj instanceof BookPK))
			return false;
		final BookPK other = (BookPK) obj;
		if (author == null) {
			if (other.author != null)
				return false;
		} else if (!author.equals(other.author))
			return false;
		if (title == null) {
			if (other.title != null)
				return false;
		} else if (!title.equals(other.title))
			return false;
		return true;
	}
}
